function submitConfig(url) {
    $.post(url, $("#settings-form").serialize(), function (data) {
        if(data.status == 'true' || data.status == true){
            BootstrapDialog.alert("添加或变更属性成功！", function() {
                $('#settings_window').modal('hide');
                window.location.reload();
            });
        }else if(data.status == 'false'){
            BootstrapDialog.alert("添加或变更属性失败！失败原因为：" + data.data, function() {

            });
        }
    });
}

function submitUpdateConfig(url) {
    $.post(url, $("#update-form").serialize(), function (data) {
        if(data.status == 'true' || data.status == true){
            BootstrapDialog.alert("变更属性成功！", function() {
                $('#update_window').modal('hide');
                window.location.reload();
            });
        }else if(data.status == 'false'){
            BootstrapDialog.alert("变更属性失败！失败原因为：" + data.data, function() {

            });
        }
    });
}

function updateConfig(url){
    $.ajax({
        type: "GET",
        url: url,
        data:{},
        dataType: "json",
        success: function(data){
            console.log(data)
            $("#update_window_name").val(data.data.name);
            $("#update_window_value").val(data.data.value);
        }
    })
    $('#update_window').modal('show');
}

function showSetWindow(show) {
    var window = $("#settings_window");
    if (show) window.show();
    else {
        window.hide();
        $("#settings-form")[0].reset();
    }
}

function showUpdateWindow(show) {
    var window = $("#update_window");
    if (show) window.show();
    else {
        window.hide();
        $("#update-form")[0].reset();
    }
}